<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<script>
$(function() {
	var sel = $('#flag');
	var flag_value = ${param.flag};
	switch(flag_value){
	case '0':
		sel[0].selected = true ;
		break;
	case '1':
		sel[1].selected = true ;
		break;
	}
});
</script>

	<div class="bjui-pageContent">
		<form class="datagrid-edit-form">
			<div class="bjui-row col-2">
				<label class="row-label">用户编号</label>
				<div class="row-input required">
					<input type="text" name="usercde" id="usercde" value="${param.usercde}" readonly="">
				</div>
				<label class="row-label">雇佣ID</label>
				<div class="row-input required">
					<input type="text" name="employeeid" id="employeeid" value="${param.employeeid}">
				</div>
				<label class="row-label">用户名</label>
				<div class="row-input required">
					<input type="text" name="username"  id="username" value="${param.username}">
				</div>
				<label class="row-label">密码</label>
				<div class="row-input required">
					<input type="text" name="userpwd"  id="userpwd" value="${param.userpwd}">
				</div>
				<label class="row-label">最后登录时间</label>
				<div class="row-input required">
					<input type="text"  name="lastlogintime" id="lastlogintime" readonly="" value="${param.lastlogintime}">
				</div>
				<label class="row-label">状态</label>
				<div class="row-input required">
					<select name="flag" id="flag" data-toggle="selectpicker"
						data-rule="required" data-width="100%">
						<option value="0">无效</option>
						<option value="1">有效</option>		
					</select>
				</div>
			</div>
			<input name="userid" id="userid" type="hidden" value="${param.userid}">
		</form>
	</div>
	<div class="bjui-pageFooter">
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">取消</button></li>
			<li><button type="button"  onclick="saveUserData();">保存</button></li>
		</ul>
	</div>

<script>

	function saveUserData() {
		BJUI.ajax('doajax', {
			url : '${pageContext.request.contextPath}'+"/editData",
			type : "post",
			data : {
				usercde : $("#usercde").val(),
				employeeid : $("#employeeid").val(),
				username : $("#username").val(),
				userpwd : $("#userpwd").val(),
				flag : $("#flag").val(),
				userid : $("#userid").val()
			},
			loadingmask : true,
			okCallback : function(data, options) {
				var json=eval(data);
          	    if(json.result == '00'){  	
          	        BJUI.dialog('closeCurrent'); 
	                $('#datagrid_id').datagrid('refresh',true); 
          	    }else{
          	    	BJUI.alertmsg('error', json.result); 
	            }
			}
		});
	}
</script>


